package com.bw.redis;

import java.util.Iterator;
import java.util.Set;

import redis.clients.jedis.Jedis;
/**
 * Redis Java Keys 实例
 * @author liang
 *
 */
public class RedisJava10 {
    public static void main(String[] args) {
    	getValueFromDatabase("*",0);
    }
    public static void getValueFromDatabase(String keyP ,int index){

        //连接本地的 Redis 服务
        Jedis jedis = new Jedis("localhost");
        System.out.println("连接成功");
        jedis.select(index);
        
  
        // 获取数据并输出
        Set<String> keys = jedis.keys(keyP); 
        Iterator<String> it=keys.iterator() ;   
        while(it.hasNext()){
            String key = it.next();   
            System.out.println(key);
        }
    }
}
